package moodish.dummy;

import java.io.IOException;
import java.net.UnknownHostException;

import javax.swing.JOptionPane;

import moodish.client.MoodishClient;
import moodish.comm.ClientComm;

public class MoodishClientDummy implements MoodishClient {

	@Override
	public void start(final ClientComm clientComm) {
		try {
			
			String nome = JOptionPane.showInputDialog("Qual o seu nome?", "joao");
			clientComm.connect("localhost", nome);
			
			System.out.println("Ligado...");
			
			
			new Thread(new Runnable() {
				
				@Override
				public void run() {
					try {
						Thread.sleep(10000);
					} catch (InterruptedException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
					}
					clientComm.disconnect();
					System.out.println("Desligado...");
					
					
				}
			}).start();
			
			
			
		} catch (UnknownHostException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	

}
